package androidx.transition;

import android.animation.TimeInterpolator;
import android.content.Context;
import android.content.res.TypedArray;
import android.content.res.XmlResourceParser;
import android.util.AndroidRuntimeException;
import android.util.AttributeSet;
import android.view.View;
import android.view.ViewGroup;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.RestrictTo;
import androidx.annotation.RestrictTo.d;
import java.util.ArrayList;
import java.util.Iterator;
import o.fx;
import o.nq;
import o.ns;
import o.nt;
import o.nv;
import o.nx;

public class TransitionSet extends Transition {
    private ArrayList<Transition> ʻ = new ArrayList();
    private boolean ˊॱ = true;
    int ˋ;
    private int ॱˊ = 0;
    boolean ᐝ = false;

    static class b extends nq {
        TransitionSet ˋ;

        b(TransitionSet transitionSet) {
            this.ˋ = transitionSet;
        }

        public void ॱ(@NonNull Transition transition) {
            if (!this.ˋ.ᐝ) {
                this.ˋ.ॱॱ();
                this.ˋ.ᐝ = true;
            }
        }

        public void ˋ(@NonNull Transition transition) {
            TransitionSet transitionSet = this.ˋ;
            transitionSet.ˋ--;
            if (this.ˋ.ˋ == 0) {
                this.ˋ.ᐝ = false;
                this.ˋ.ͺ();
            }
            transition.ॱ((androidx.transition.Transition.b) this);
        }
    }

    public /* synthetic */ Object clone() throws CloneNotSupportedException {
        return ॱˋ();
    }

    @NonNull
    public /* synthetic */ Transition ˊ(@NonNull View view) {
        return ॱ(view);
    }

    @NonNull
    public /* synthetic */ Transition ˊ(@NonNull androidx.transition.Transition.b bVar) {
        return ˎ(bVar);
    }

    @NonNull
    public /* synthetic */ Transition ˋ(long j) {
        return ॱ(j);
    }

    @NonNull
    public /* synthetic */ Transition ˋ(@Nullable TimeInterpolator timeInterpolator) {
        return ॱ(timeInterpolator);
    }

    @NonNull
    public /* synthetic */ Transition ˎ(long j) {
        return ˏ(j);
    }

    @NonNull
    public /* synthetic */ Transition ˏ(@NonNull View view) {
        return ॱॱ(view);
    }

    @NonNull
    public /* synthetic */ Transition ॱ(@NonNull androidx.transition.Transition.b bVar) {
        return ˋ(bVar);
    }

    public TransitionSet(Context context, AttributeSet attributeSet) {
        super(context, attributeSet);
        TypedArray obtainStyledAttributes = context.obtainStyledAttributes(attributeSet, ns.ʽ);
        ˊ(fx.ˊ(obtainStyledAttributes, (XmlResourceParser) attributeSet, "transitionOrdering", 0, 0));
        obtainStyledAttributes.recycle();
    }

    @NonNull
    public TransitionSet ˊ(int i) {
        switch (i) {
            case 0:
                this.ˊॱ = true;
                break;
            case 1:
                this.ˊॱ = false;
                break;
            default:
                throw new AndroidRuntimeException("Invalid parameter for TransitionSet ordering: " + i);
        }
        return this;
    }

    @NonNull
    public TransitionSet ˋ(@NonNull Transition transition) {
        this.ʻ.add(transition);
        transition.ॱ = this;
        if (this.ˏ >= 0) {
            transition.ˎ(this.ˏ);
        }
        if ((this.ॱˊ & 1) != 0) {
            transition.ˋ(ˏ());
        }
        if ((this.ॱˊ & 2) != 0) {
            transition.ˊ(ॱˊ());
        }
        if ((this.ॱˊ & 4) != 0) {
            transition.ॱ(ˋॱ());
        }
        if ((this.ॱˊ & 8) != 0) {
            transition.ˎ(ˏॱ());
        }
        return this;
    }

    public int ᐝॱ() {
        return this.ʻ.size();
    }

    public Transition ˋ(int i) {
        if (i < 0 || i >= this.ʻ.size()) {
            return null;
        }
        return (Transition) this.ʻ.get(i);
    }

    @NonNull
    public TransitionSet ˏ(long j) {
        super.ˎ(j);
        if (this.ˏ >= 0) {
            int size = this.ʻ.size();
            for (int i = 0; i < size; i++) {
                ((Transition) this.ʻ.get(i)).ˎ(j);
            }
        }
        return this;
    }

    @NonNull
    public TransitionSet ॱ(long j) {
        return (TransitionSet) super.ˋ(j);
    }

    @NonNull
    public TransitionSet ॱ(@Nullable TimeInterpolator timeInterpolator) {
        this.ॱˊ |= 1;
        if (this.ʻ != null) {
            int size = this.ʻ.size();
            for (int i = 0; i < size; i++) {
                ((Transition) this.ʻ.get(i)).ˋ(timeInterpolator);
            }
        }
        return (TransitionSet) super.ˋ(timeInterpolator);
    }

    @NonNull
    public TransitionSet ॱ(@NonNull View view) {
        for (int i = 0; i < this.ʻ.size(); i++) {
            ((Transition) this.ʻ.get(i)).ˊ(view);
        }
        return (TransitionSet) super.ˊ(view);
    }

    @NonNull
    public TransitionSet ˎ(@NonNull androidx.transition.Transition.b bVar) {
        return (TransitionSet) super.ˊ(bVar);
    }

    @NonNull
    public TransitionSet ॱॱ(@NonNull View view) {
        for (int i = 0; i < this.ʻ.size(); i++) {
            ((Transition) this.ʻ.get(i)).ˏ(view);
        }
        return (TransitionSet) super.ˏ(view);
    }

    @NonNull
    public TransitionSet ˋ(@NonNull androidx.transition.Transition.b bVar) {
        return (TransitionSet) super.ॱ(bVar);
    }

    public void ॱ(PathMotion pathMotion) {
        super.ॱ(pathMotion);
        this.ॱˊ |= 4;
        for (int i = 0; i < this.ʻ.size(); i++) {
            ((Transition) this.ʻ.get(i)).ॱ(pathMotion);
        }
    }

    private void ॱˎ() {
        androidx.transition.Transition.b bVar = new b(this);
        Iterator it = this.ʻ.iterator();
        while (it.hasNext()) {
            ((Transition) it.next()).ˊ(bVar);
        }
        this.ˋ = this.ʻ.size();
    }

    @RestrictTo({d.ˊ})
    protected void ॱ(ViewGroup viewGroup, nv nvVar, nv nvVar2, ArrayList<nx> arrayList, ArrayList<nx> arrayList2) {
        long ˊ = ˊ();
        int size = this.ʻ.size();
        int i = 0;
        while (i < size) {
            Transition transition = (Transition) this.ʻ.get(i);
            if (ˊ > 0 && (this.ˊॱ || i == 0)) {
                long ˊ2 = transition.ˊ();
                if (ˊ2 > 0) {
                    transition.ˋ(ˊ2 + ˊ);
                } else {
                    transition.ˋ(ˊ);
                }
            }
            transition.ॱ(viewGroup, nvVar, nvVar2, arrayList, arrayList2);
            i++;
        }
    }

    @RestrictTo({d.ˊ})
    protected void ˎ() {
        if (this.ʻ.isEmpty()) {
            ॱॱ();
            ͺ();
            return;
        }
        ॱˎ();
        if (this.ˊॱ) {
            Iterator it = this.ʻ.iterator();
            while (it.hasNext()) {
                ((Transition) it.next()).ˎ();
            }
            return;
        }
        for (int i = 1; i < this.ʻ.size(); i++) {
            final Transition transition = (Transition) this.ʻ.get(i);
            ((Transition) this.ʻ.get(i - 1)).ˊ(new nq(this) {
                final /* synthetic */ TransitionSet ˋ;

                public void ˋ(@NonNull Transition transition) {
                    transition.ˎ();
                    transition.ॱ((androidx.transition.Transition.b) this);
                }
            });
        }
        Transition transition2 = (Transition) this.ʻ.get(0);
        if (transition2 != null) {
            transition2.ˎ();
        }
    }

    public void ˋ(@NonNull nx nxVar) {
        if (ˎ(nxVar.ॱ)) {
            Iterator it = this.ʻ.iterator();
            while (it.hasNext()) {
                Transition transition = (Transition) it.next();
                if (transition.ˎ(nxVar.ॱ)) {
                    transition.ˋ(nxVar);
                    nxVar.ˎ.add(transition);
                }
            }
        }
    }

    public void ॱ(@NonNull nx nxVar) {
        if (ˎ(nxVar.ॱ)) {
            Iterator it = this.ʻ.iterator();
            while (it.hasNext()) {
                Transition transition = (Transition) it.next();
                if (transition.ˎ(nxVar.ॱ)) {
                    transition.ॱ(nxVar);
                    nxVar.ˎ.add(transition);
                }
            }
        }
    }

    void ˊ(nx nxVar) {
        super.ˊ(nxVar);
        int size = this.ʻ.size();
        for (int i = 0; i < size; i++) {
            ((Transition) this.ʻ.get(i)).ˊ(nxVar);
        }
    }

    @RestrictTo({d.ˊ})
    public void ˋ(View view) {
        super.ˋ(view);
        int size = this.ʻ.size();
        for (int i = 0; i < size; i++) {
            ((Transition) this.ʻ.get(i)).ˋ(view);
        }
    }

    @RestrictTo({d.ˊ})
    public void ᐝ(View view) {
        super.ᐝ(view);
        int size = this.ʻ.size();
        for (int i = 0; i < size; i++) {
            ((Transition) this.ʻ.get(i)).ᐝ(view);
        }
    }

    public void ˊ(nt ntVar) {
        super.ˊ(ntVar);
        this.ॱˊ |= 2;
        int size = this.ʻ.size();
        for (int i = 0; i < size; i++) {
            ((Transition) this.ʻ.get(i)).ˊ(ntVar);
        }
    }

    public void ˎ(Transition.d dVar) {
        super.ˎ(dVar);
        this.ॱˊ |= 8;
        int size = this.ʻ.size();
        for (int i = 0; i < size; i++) {
            ((Transition) this.ʻ.get(i)).ˎ(dVar);
        }
    }

    String ˎ(String str) {
        String ˎ = super.ˎ(str);
        int i = 0;
        while (i < this.ʻ.size()) {
            String str2 = ˎ + "\n" + ((Transition) this.ʻ.get(i)).ˎ(str + "  ");
            i++;
            ˎ = str2;
        }
        return ˎ;
    }

    public Transition ॱˋ() {
        TransitionSet transitionSet = (TransitionSet) super.ॱˋ();
        transitionSet.ʻ = new ArrayList();
        int size = this.ʻ.size();
        for (int i = 0; i < size; i++) {
            transitionSet.ˋ(((Transition) this.ʻ.get(i)).ॱˋ());
        }
        return transitionSet;
    }
}
